import cv2
import numpy as np
img = np.zeros((320,320,3))
print(img.shape)
ptLeftTop =(60,60)
ptRightBottom =(260,260)
point_color = (0, 255, 0)
thickness = 1
lineType = 4
cv2.rectangle(img, ptLeftTop, ptRightBottom, point_color, thickness, lineType)
ptLeftTop = (120, 100)
ptRightBottom = (200, 150)
point_color = (0, 0, 255) # BGR
thickness = 1
lineType = 8
cv2.rectangle(img, ptLeftTop, ptRightBottom, point_color, thickness, lineType)
cv2.namedWindow("1")
cv2.imshow('1', img)
cv2.waitKey (10000) # 显示 10000 ms 即 10s 后消失
cv2.destroyAllWindows()